//
//  CommunityIMGTableViewCell.m
//  Cup
//
//  Created by dllo on 15/4/25.
//  Copyright (c) 2015年 doll. All rights reserved.
//

#import "CommunityIMGTableViewCell.h"

@implementation CommunityIMGTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.title = [[UILabel alloc]init];
        self.title.font = [UIFont fontWithName:@"Courier New" size:16];
        [self.contentView addSubview:self.title];
        [_title release];
        self.content = [[UILabel alloc]init];
        self.content.font = [UIFont systemFontOfSize:13];
        self.content.numberOfLines = 3;
        [self.content sizeToFit];
        self.content.textColor = [UIColor colorWithRed:62/255.0 green:72/255.0 blue:72/255.0 alpha:1];
        [self.contentView addSubview:self.content];
        [_content release];
        self.coverIMG = [[UIImageView alloc]init];
        [self.contentView addSubview:self.coverIMG];
        [_coverIMG release];
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"Courier New" size:16],NSFontAttributeName, nil];
    CGRect rect = [self.title.text boundingRectWithSize:CGSizeMake(self.contentView.frame.size.width - 30, 400) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    self.title.frame = CGRectMake(15, 18, self.contentView.frame.size.width - 30, rect.size.height);
    self.coverIMG.frame = CGRectMake(15, rect.size.height+30, 60, 60);
    self.content.frame = CGRectMake(100, rect.size.height+15, self.contentView.frame.size.width - 115 , 80);
}

- (void)dealloc
{
    [_title release];
    [_content release];
    [_coverIMG release];
    [super dealloc];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
